<%--
  Created by IntelliJ IDEA.
  User: LJS
  Date: 2018/11/18
  Time: 16:08
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page trimDirectiveWhitespaces="true"%>
<%@page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName()
            + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>值班表</title>
    <jsp:include page="resource.jsp"/>
    <script type="text/javascript">
        //updateWork
        function updateWork(){
            var workDate = $("#updateWorkDate").val();
            var workStaffNo = $("#updateWorkStaffNo").val();
            var workStaffName = $("#updateWorkStaffName").val();

            $.ajax({
                url:"${pageContext.request.contextPath}/notice/work/update.do",
                type:"post",
                async:false,
                data:{
                    workDate: workDate,
                    workStaffNo: workStaffNo,
                    workStaffName: workStaffName
                },
                dataType: 'json',
                success:function(data){
                    if(data.res.trim() === "1" ) {
                        window.location.reload();
                    }else{
                        //...
                    }
                }
            })
        }
    </script>
</head>
<body>
<jsp:include page="common.jsp"/>

<!-- Start #content -->
<div id="content">
    <!-- Start .content-wrapper -->
    <div class="content-wrapper">
        <!-- Start .row -->
        <div class="row">
            <!-- Start .page-header -->
            <div class="col-lg-12 heading">
                <h1 class="page-header"><i class="en-flag"></i> 值班表</h1>
            </div>
            <!-- End .page-header -->
        </div>
        <!-- End .row -->
        <!-- Start .outlet -->
        <div class="outlet">
            <!-- Page start here ( usual with .row ) -->
            <div class="row printable">
                <!-- col-lg-12 start here -->
                <div class="col-lg-12">
                    <!-- Start .panel -->
                    <div class="panel panel-default plain">
                        <div class="panel-heading white-bg"></div>
                        <div class="panel-body">
                            <!-- Start .invoice -->
                            <div class="invoice">
                                <a href="<%=basePath%>notice/person/list.do" class="mb5">返回</a>
                                <!-- Start .invoice-header -->
                                <div class="invoice-header">
                                    <hr/>
                                    <jsp:useBean id="allRotaTable" class="net.office.utils.RotaBean" scope="session" />
                                    <jsp:setProperty name="allRotaTable" property="*"/>
                                    <jsp:setProperty name="allRotaTable" property="staffInfoList" value="${staffInfoList}"/>
                                    <form class="form-horizontal" role="form" action="<%=basePath%>notice/all/search.do" method="post">
                                        <div class="form-group col-md-6">
                                            <label for="staffNo" class="col-md-4 control-label">工号：</label>
                                            <div class="col-md-8">
                                                <input type="text" class="form-control limitInput" maxlength="20" id="staffNo" name="staffNo">
                                            </div>
                                        </div>
                                        <div class="form-group col-md-6">
                                            <label for="staffName" class="col-md-4 control-label">姓名：</label>
                                            <div class="col-md-8">
                                                <input type="text" class="form-control limitInput" maxlength="20" id="staffName" name="staffName" />
                                            </div>
                                        </div>
                                        <div class="form-group col-md-6">
                                            <label for="year" class="col-md-4 control-label">年份：</label>
                                            <div class="col-md-8">
                                                <input type="text" class="form-control" id="year" name="year">
                                            </div>
                                        </div>
                                        <div class="form-group col-md-6">
                                            <label for="month" class="col-md-4 control-label">月份：</label>
                                            <div class="col-md-8">
                                                <select class="form-control" id="month" name="month">
                                                    <option value="">--请选择--</option>
                                                    <c:forEach var="x" begin="1" end="12">
                                                        <option value="${x }" >${x}</option>
                                                    </c:forEach>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <input type="submit" class="form-control btn btn-primary" value="搜索" />
                                        </div>
                                    </form>
                                </div>
                                <!-- End .invoice-header -->

                                <!-- Start .invoice-content -->
                                <div class="invoice-content">
                                    <a href="#" class="btn btn-primary mb5" data-toggle="modal" data-target="#myModal">修改</a>
                                    <span class="color-blue pull-right mt15">
                                        <jsp:getProperty name="allRotaTable" property="year"/>年
                                        <jsp:getProperty name="allRotaTable" property="month"/>月
                                    </span>
                                    <jsp:getProperty name="allRotaTable" property="calendar" />
                                </div>
                            </div>
                            <!-- End .invoice -->
                        </div>
                    </div>
                    <!-- End .panel -->
                </div>
                <!-- col-lg-12 end here -->
            </div>
            <!-- Page End here -->
        </div>
        <!-- End .outlet -->
    </div>
    <!-- End .content-wrapper -->
    <div class="clearfix"></div>
</div>
<!-- End #content -->

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h5 class="modal-title" id="myModalLabel">编辑值班表</h5>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" role="form">
                    <div class="form-group">
                        <label for="updateWorkDate" class="col-sm-3 control-label">值班日期：</label>
                        <div class="col-sm-9">
                            <input class="form-control datetime-picker2" type="text" id="updateWorkDate" name="workDate">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="updateWorkStaffNo" class="col-sm-3 control-label">值班员工工号：</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control limitInput" maxlength="20" id="updateWorkStaffNo" name="updateWorkStaffNo">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="updateWorkStaffName" class="col-sm-3 control-label">值班员工姓名：</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control limitInput" maxlength="20" id="updateWorkStaffName" name="updateWorkStaffName">
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="updateWork()">保存修改</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- /.modal -->
</body>
</html>
